Page({
  data: {
    repairList: [],
    isEmpty: true
  },
  goDetail (ev) {
    wx.navigateTo({
      url: '/repair_pkg/pages/detail/index?id=' + ev.mark.id
    })
  },
  onLoad () {
    this.getRepairList()
  },
  onShow () {
    this.getRepairList()
  },
  async getRepairList () {
    const { code, data } = await wx.http.get('/repair')
    if (code !== 10000) return wx.utils.toast()
    this.setData({
      repairList: data.rows,
      isEmpty: false
    })
  },
  addRepair () {
    wx.navigateTo({
      url: '/repair_pkg/pages/form/index'
    })
  }
})
